package priv.stones.reflect;

import java.util.Date;

/**
 * @Author: Stones
 * @Description:
 * @Date: 2017/9/26 10:00
 */
class Person {
    public Person() {
        System.out.println("init");
    }

    public Person(String name) {
        System.out.println("init");
    }

    public void Say(String str) {

        System.out.println("output :" + str);
    }

}

public class Reflect2 {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Class<?> cls1 = Class.forName("java.util.Date");
        Date date1 = (Date) cls1.newInstance();
        System.out.println(date1);

        Person person = (Person) Class.forName("priv.stones.reflect.Person").newInstance();
        person.Say("say something");

    }

}
